﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace VideoServer.ViewModel.Helpers
{
    public class SystemSettingHelper
    {
        private static string systemSettingFilePath = AppDomain.CurrentDomain.BaseDirectory+"SystemSetting.xml";

        public static string GetFileSaveSettingValue(string key)
        {
            XDocument doc = XDocument.Load(systemSettingFilePath);
            var element = doc.Element("SystemSetting").Element("FileSaveSetting").Elements().First(x=>x.Name==key);
            return element.Value;
        }

        public static void SetFileSaveSettingValue(string key,string value)
        {
            XDocument doc = XDocument.Load(systemSettingFilePath);
            var element = doc.Element("SystemSetting").Element("FileSaveSetting").Elements().First(x => x.Name == key);
            element.SetValue(value);
            doc.Save(systemSettingFilePath);
        }
    }
}
